All Questions
45 questions
3votes
1answer
363views
Python function to find the count of digits of numerals in base n up to a given limit
This is a simple exercise to find the count of digits of all numerals in a given base up to a given limit (not including the limit), I wrote it to determine the ratio of bytes saved when the numbers ...
1vote
2answers
718views
Find the cheapest flight to reach from source to destination
As the input you get the flight schedule as an array, each element of which is the price of a direct flight between 2 cities ...
2votes
1answer
4kviews
The smallest positive number that is evenly divisible by all of the numbers from 1 to 20
Problem description: 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest positive number that is evenly divisible by all of ...
6votes
1answer
751views
LFU Cache implementation in Python 3
Need some feedback on this implementation of LFU cache in python3. Original problem : https://leetcode.com/problems/lfu-cache/ Would really appreciate some feedback on readability, understandability ...
3votes
1answer
604views
3Sum LeetCode problem coding challenge
LeetCode 3Sum problem: Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0. Notice that the ...
4votes
1answer
208views
Another Sliding Window - find each `k-size` window the maximum num. from an integer array/list
I've searched this site and find many similar questions, but not exactly the same as the one I'll post. This attempts to solve Leetcode 239: You are given an array of integers ...
3votes
2answers
590views
LeetCode 8: String to Integer (atoi)
I'm posting a solution for LeetCode's "String to Integer (atoi)". If you'd like to review, please do. Thank you! Problem Implement atoi which converts a string to an integer. The function ...
2votes
0answers
58views
Getting the minimum possible value from list consist of '0' and '1' by multiply no. of [0,1] and add the result after sliced in 'k' section [closed]
This code write to determine a way to place the N horses into the K stables, so that the total coefficient of unhappiness is minimized. I use python to write a code and I want to reduce the running ...
3votes
1answer
2kviews
LeetCode 1615: Maximal Network Rank
I'm posting a solution for LeetCode's "Maximal Network Rank". If you'd like to review, please do so. Thank you! Problem There is an infrastructure of n cities with some number of roads ...
3votes
1answer
46views
Update UNIX-like system user profile picture with its GitHub account's one
Seeking to learning and have fun, I wrote out this script (what I expected to be) self explanatory and would appreciate some comments on that. I published it as a gist and tried to do my best on what ...
1vote
1answer
106views
LeetCode 124: Binary Tree Maximum Path Sum 2
I'm posting my code for a LeetCode problem. If you'd like to review, please do so. Thank you for your time! Problem Given a non-empty binary tree, find the maximum path sum. For this problem, a path ...
8votes
1answer
5kviews
XOR Encryption, Decryption, and Cracking in Python
I have recently been working through a number of the Cryptopals Cryptography Challenges to try and improve my knowledge and understanding of both cryptography and Python. As five of the first six ...
3votes
1answer
417views
LeetCode 146: LRU Cache II
I'm posting my code for a LeetCode problem. If you'd like to review, please do so. Problem Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following ...
1vote
1answer
1kviews
Shortest path in Binary Maze
I want a feedback on my code for the below known problem from Daily coding challenge: You are given an M by N matrix consisting of booleans that represents a board. Each True boolean represents a ...
4votes
1answer
1kviews
Given an integer array A and a range, find a subarray within the range with a minimum sum
Problem HackerRank Range query: You are given an array A of n integers. You have to perform ...